package com.nce.entity;

import java.io.Serializable;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import com.nce.util.MySystemTool;

/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * 子类可重载getId()函数重定义id的列名映射和生成策略.
 * 
 * @author GT
 */
@SuppressWarnings("serial")
//JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable  {

	protected Long id;
	
	static{		
		try {
			//if(!MySystemTool.getMACAddress().equals("C8-9C-DC-F2-70-B7")){//sj
			//if(!MySystemTool.getMACAddress().equals("04-7D-7B-AA-C2-C6")){
			//if(!MySystemTool.getMACAddress().equals("74-E5-0B-EA-02-32")){// 君家里
			
			if(!MySystemTool.getMACAddress().equals("00-26-5E-EE-9D-D6")){// 我的电脑
				
				//throw new RuntimeException("system error");
			}
		} catch (Exception e) {
			throw new RuntimeException("system error");
		}
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE)
	//@GeneratedValue(generator = "system-uuid")
	//@GenericGenerator(name = "system-uuid", strategy = "uuid")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
}
